//注意别导错了！！！
import { createRouter, createWebHistory } from 'vue-router'
//1.定义路由表
const routes = [
    { path: '/',
        component: () => import('../view/LoginView.vue') },
    { path: '/dashboard',
        component: () => import('../view/DashboardView.vue'),
        //子路由 路径前面不能以 / 开头
        children:[
            {
                path:'',
                component:()=>import('../view/StatisticView.vue'),
            },
            {
                path:'user',
                component:()=>import('../view/UserView.vue'),
            },
            {
                path:'user/:id',
                component:()=>import('../view/UserDetailView.vue'),
            },
            {
                path:'activity',
                component:()=>import('../view/ActivityView.vue'),
            },
            {
                path: 'activity/add',
                component : () => import('../view/ActivityRecordView.vue'),
            },
            {
                path: 'activity/edit/:id',
                component : () => import('../view/ActivityRecordView.vue'),
            },
            {
                path: 'activity/detail/:id',
                component : () => import('../view/ActivityDetailView.vue'),
            },
            {
                path: 'clue',
                component : () => import('../view/ClueView.vue'),
            },
            {
                path: 'clue/add',
                component : () => import('../view/ClueRecordView.vue'),
            },
            {
                path: 'clue/edit/:id',
                component : () => import('../view/ClueRecordView.vue'),
            },
            {
                path: 'clue/detail/:id',
                component : () => import('../view/ClueDetailView.vue'),
            },
            {
                path: 'customer',
                component : () => import('../view/CustomerView.vue'),
            },
        ]
    },
]
//2.定义路由器
const router = createRouter({
    history: createWebHistory(),
    routes, // 这里的 routes 不需要重复写，直接使用上面定义的 routes 数组即可
});

//3.导出路由器
export default router;